#!/bin/sh

die() {
	echo
	echo "error: $1";
	echo
	exit -1;
}

echo

echo -n "removing autom4te.cache..."
rm -Rf autom4te.cache
if [ "$?" != "0" ]; then die "removing autom4te.cache"; fi
echo "done"

echo -n "running autoheader..."
autoheader
if [ "$?" != "0" ]; then die "running autoheader"; fi
echo "done"

echo -n "running libtoolize..."
libtoolize -c --automake
if [ "$?" != "0" ]; then die "running libtoolize"; fi
echo "done"

echo -n "running aclocal..."
if test -r acinclude.m4; then
   touch acinclude.m4
   aclocal-1.9
else
   aclocal-1.9 -I config/autoconf
fi
if [ "$?" != "0" ]; then die "running aclocal"; fi
echo "done"

echo -n "running autoconf..."
autoconf
if [ "$?" != "0" ]; then die "running autoconf"; fi
echo "done"

echo -n "running automake..."
automake-1.9 -a -c
if [ "$?" != "0" ]; then die "running automake"; fi
echo "done"

echo
